package com.MusicWeb.service;

import com.MusicWeb.dao.DB;
import com.MusicWeb.entity.Column;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/*
获取栏目的信息
 */
public class ColumnService {
    public List<Column> SelectColumn() {
        List<Map<String, Object>> result = DB.executeQuery("SELECT * FROM t_column");
        List<Column> list = new ArrayList<>();
        if (result != null) {
            for (Map<String, Object> stringObjectMap : result) {
                Column column = new Column();
                column.setId((Integer) stringObjectMap.get("id"));
                column.setColumn_name((String) stringObjectMap.get("column_name"));
                list.add(column);
            }
        }
        return list;
    }
}
